namespace AppFlat.Domain.Respostory.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class init : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.AppInfo",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        Name = c.String(nullable: false, maxLength: 20),
                        CategoryId = c.Int(nullable: false),
                        LastVersion = c.String(maxLength: 20),
                        DevUserId = c.Int(nullable: false),
                        Remark = c.String(maxLength: 50),
                        Rom = c.String(maxLength: 20),
                        State = c.Int(nullable: false),
                    })
                .PrimaryKey(t => t.Id)
                .ForeignKey("dbo.Category", t => t.CategoryId)
                .ForeignKey("dbo.DevUser", t => t.DevUserId)
                .Index(t => t.CategoryId)
                .Index(t => t.DevUserId);
            
            CreateTable(
                "dbo.Category",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        Name = c.String(nullable: false, maxLength: 20),
                        ParentId = c.Int(nullable: false),
                    })
                .PrimaryKey(t => t.Id);
            
            CreateTable(
                "dbo.DevUser",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        Name = c.String(),
                        Password = c.String(),
                        Email = c.String(),
                    })
                .PrimaryKey(t => t.Id);
            
            CreateTable(
                "dbo.DataDictionary",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        TypeName = c.String(maxLength: 20),
                        ValueId = c.Int(nullable: false),
                        ValueName = c.String(maxLength: 20),
                    })
                .PrimaryKey(t => t.Id);
            
        }
        
        public override void Down()
        {
            DropForeignKey("dbo.AppInfo", "DevUserId", "dbo.DevUser");
            DropForeignKey("dbo.AppInfo", "CategoryId", "dbo.Category");
            DropIndex("dbo.AppInfo", new[] { "DevUserId" });
            DropIndex("dbo.AppInfo", new[] { "CategoryId" });
            DropTable("dbo.DataDictionary");
            DropTable("dbo.DevUser");
            DropTable("dbo.Category");
            DropTable("dbo.AppInfo");
        }
    }
}
